function injectImages(images) {
  const container = document.getElementById('images-container');
  
  images.forEach(url => {
    const img = document.createElement('img');
    img.src = url;
    img.alt = 'Image';
    img.style.margin = '10px';
    img.style.border = '2px solid #ccc';
    container.appendChild(img);
  });
}

// Send tip to content script via messaging
chrome.runtime.onMessage.addListener(async (message, sender, sendResponse) => {
    console.log(message)
    if (message.action === 'openTabWithImages1') {
        if (!message.items) return
        // let data = await chrome.storage.local.get([message.url]);
        const { items } = await chrome.runtime.sendMessage({ action: 'imageUrl', items: message.items });
        document.querySelector("#images-container span").style.display = 'none'
		if (items) {
            injectImages(items.map(item=>item.remoteUrl))
        }
    }
  
});